<?php
header("Content-type: text/html; charset=utf-8");
ini_set('display_errors', 1);
set_time_limit(0);
include_once dirname(dirname(__FILE__)) . '/mgtv_v2/mgtv_init.php';
set_time_limit(0);
$db = nn_get_db(NL_DB_WRITE);
$db->open();
$file = fopen("media.csv","r");
while(! feof($file))
{
  $arr = (fgetcsv($file));
  
  
  $sql = "select * from nns_vod_media where nns_id='{$arr[0]}'";
  $info = nl_db_get_one($sql, $db);
  if(is_array($info)&&!empty($info)){
  	
	$sql_update = "update nns_vod_media set nns_original_id='".$info['nns_import_id']."' where nns_import_id='".$info['nns_id']."';";
  }  
  error_log($sql_update.PHP_EOL,3,'sql.log');
}
fclose($file);
unset($db,$file);